﻿using Nebular.ExpenseManagement.Model;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections;

namespace Nebular.ExpenseManagement.Model.Test
{
    
    
    /// <summary>
    ///This is a test class for BatchJobTest and is intended
    ///to contain all BatchJobTest Unit Tests
    ///</summary>
    [TestClass()]
    public class BatchJobTest
    {


        private TestContext testContextInstance;
        
        // Keep a list of job created etc. For Cleanup.
        private ArrayList jobList;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        [TestInitialize()]
        public void MyTestInitialize()
        {
            jobList = new ArrayList(5);
        }
        
        //Use TestCleanup to run code after each test has run
        [TestCleanup()]
        public void MyTestCleanup()
        {
            if ( jobList.Count > 0)
            {
                BatchJob bj = new BatchJob();
                foreach (Guid g in jobList)
                {
                    bj.UpdateBatchJob(BatchJob.done, g);
                }
            }
        }
        
        #endregion


        /// <summary>
        ///A test for UpdateBatchJob
        ///</summary>
        [TestMethod(), Ignore]
        public void UpdateBatchJobTest()
        {
            BatchJob target = new BatchJob(); // TODO: Initialize to an appropriate value
            string state = string.Empty; // TODO: Initialize to an appropriate value
            Guid jobID = new Guid(); // TODO: Initialize to an appropriate value
            target.UpdateBatchJob(state, jobID);
            Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }

        /// <summary>
        ///A test for GetBatchJobs
        ///</summary>
        [TestMethod(), Ignore]
        public void GetBatchJobsTest()
        {
            BatchJob target = new BatchJob(); // TODO: Initialize to an appropriate value
            IBatchJob[] expected = null; // TODO: Initialize to an appropriate value
            IBatchJob[] actual;
            actual = target.GetBatchJobs();
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for CreateBatchJob
        ///</summary>
        [TestMethod()]
        public void CreateBatchJobTest()
        {
            BatchJob target = new BatchJob(); 
            string jobName = "Model.Test.BatchJob";
            Guid actual;
            actual = target.CreateBatchJob(jobName);
            Assert.IsNotNull(actual);
            jobList.Add(actual);

             
        }

    }
}
